import numpy as np
import cv2 as cv
import sys
from texttable import Texttable

t = Texttable(max_width=0)
t.add_row(['path', 'dtype', 'shape'])

def inspect(path):
    global img
    img = cv.imread(path, cv.IMREAD_UNCHANGED)

    if len(img.shape) >= 3:
        print('Check all close:')
        for a, b in ((0, 1), (0, 2), (1, 2)):
            res = np.allclose(img[:, :, a], img[:, :, b])
            print(f'{a},{b}: {res}')

    t.add_row([path, img.dtype, img.shape])

cnt = 0
for path in sys.argv[1:]:
    inspect(path)
    cnt += 1
if not cnt:
    inspect('/home/asuspei/python_ai/category/data/_data/mnist_dataset_png_gen.py/test/1_8.png')

print(t.draw())

cv.imshow('img', img)
cv.waitKey()
cv.destroyAllWindows()
